package com.company.shop;

import com.company.creature.Creature;

import javax.xml.transform.Result;

/**
 * @description:
 * @author: ZhaoYicong
 * @date: Created in 2020/4/27 17:19
 * @version: v1.0
 * @modified By:
 */
public class RandomBlood extends Attribute {
    @Override
    public String getSay() {
        return "重置自身的生命上限   范围：250~2750";
    }

    @Override
    public void function(Creature creature) {
        int t=creature.getHp();
        int result=(int)(Math.random()*2750+250);
        if(result<t){
            creature.setHp(result);
        }
        creature.setHplimit(result);
        creature.setMoney(creature.getMoney()-this.getSmoney());
    }

    public RandomBlood(int smoney, String id, String name) {
        super(smoney, id, name);
    }
}
